#ifndef NET_MANAGER_INCLUDE_H__
#define NET_MANAGER_INCLUDE_H__

#include <net_module.h>
#include <singleton.h>
#include <boost/thread.hpp>
#include "SessionEventHandler.h"

class CNetManager : public CSingleton<CNetManager>
{
	friend class CSingleton<CNetManager>;
private:
	// default constructor
	CNetManager(void);

	// default destructor;
	~CNetManager(void);
public:
	bool Init();

	bool Connect(const char * szIPAddress, const char * szPort);
private:
	void _StartWork();

	void _StopThread();
private:
	utility::network::connector * m_pConnector;
	utility::network::net_module * m_pNetworkModule;
	CSessionEventHandler m_oConnectorEventHandler;
	boost::thread * m_pWorkThread;
	volatile bool m_bTerminated;
};

#endif